package com.mail.server.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mail.dubbo.api.SmsCouponHistoryApi;
import com.mail.model.db.SmsCouponHistory;
import com.mail.model.vo.PageResult;
import com.mail.server.common.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author yan
 * @date 2022/06/23 09:44
 **/
@Service
public class SmsCouponHistoryService {
    @DubboReference
    private SmsCouponHistoryApi smsCouponHistoryApi;
    public R list(Long couponId, Long pageNum, Long pageSize, Integer type, String orderSn) {
        SmsCouponHistory smsCouponHistory=new SmsCouponHistory();
        smsCouponHistory.setCouponId(couponId);
        smsCouponHistory.setGetType(type);
        smsCouponHistory.setOrderSn(orderSn);
        Page<SmsCouponHistory> page =smsCouponHistoryApi.list(pageNum,pageSize,smsCouponHistory);
        PageResult pageResult =new PageResult(pageNum,pageSize,page.getTotal(),page.getRecords());
        return R.success(pageResult);
    }
}
